<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:t="http://myfaces.apache.org/tomahawk"
	template="/pages/template/main-layout-nologin.xhtml">

	<ui:define name="left">
		<h:form id="loginForm" prependId="false">
			<p:growl id="messages" life="3000" />
			<t:saveState value="#{helpdeskRegisterBean.domainId}"/>
			<t:saveState value="#{helpdeskRegisterBean.childId}"/>
			<t:saveState value="#{helpdeskRegisterBean.customerName}"/>
			
			<p:panel id="panel" header="#{msgs.default_app_name}">
				<h:panelGrid columns="2" cellpadding="5" width="100%" style="text-align:left;">
					<h:outputLabel for="customer" value="#{msgs.customer_title}" />
					<p:autoComplete completeMethod="#{helpdeskRegisterBean.completeQueryCustomerName}"
						id="customer" size="40" style="validator:checkNotNull(#{msgs.customer_title}));width:96%;"
						maxlength="80" value="#{helpdeskRegisterBean.customerName}" forceSelection="true"
						minQueryLength="3" >
						<p:ajax event="itemSelect" listener="#{helpdeskRegisterBean.selectParent}" 
							update=":loginForm:childrenList"/>
					</p:autoComplete>
					
					<h:outputLabel for="customer" value="#{msgs.customer_title} Children" />
					<h:selectOneMenu value="#{helpdeskRegisterBean.childId}" id="childrenList" 
						converter="longConverter">
						<f:selectItem itemLabel="" itemValue=""/>
						<f:selectItems value="#{helpdeskRegisterBean.childrenItemList}"/>
					</h:selectOneMenu>
					
					<h:outputLabel for="username" value="#{msgs.login_user}" />
					<p:inputText id="username" value="#{helpdeskRegisterBean.user.userName}"
						style="validator:checkNotNull(#{msgs.login_user}));width:96%;" maxlength="40"
						requiredMessage="#{msgs.login_user} #{msgs.required}">
					</p:inputText>

					<h:outputLabel for="email" value="#{msgs.dept_email}" />
					<p:inputText id="email"
						style="validator:checkemail(#{msgs.dept_email})ANDcheckNotNull(#{msgs.dept_email});width:96%"
						value="#{helpdeskRegisterBean.user.email}" maxlength="60" />

					<h:panelGroup></h:panelGroup>
					<p:commandButton value="#{msgs.button_submit}" style="float:right"
						onclick="return validator('loginForm')" update="messages,panel" icon="ui-icon-disk"
						actionListener="#{helpdeskRegisterBean.registerAction}" />
				</h:panelGrid>
			</p:panel>

			<p />

			<p:calendar id="calen" mode="inline" locale="hr" showButtonPanel="true" navigator="true"
				style="width:100%" />
		</h:form>
	</ui:define>

	<ui:define name="content">
		<ui:include src="/pages/loginMainPage.xhtml" />
	</ui:define>
</ui:composition>